<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			window.onload = function(){
				
				var btn = document.getElementById("btn")
				var num = document.getElementById("num")
				btn.onclick = function (){
					// 创建一个Worker对象
					var worker = new Worker("js/worker.js")
					
					// 绑定接受消息的监听
					worker.onmessage = function(event){
						console.log("主线程接受分线程返回的数据: " + event.data)
						alert(event.data)
					}
					
					// 向分线程发送消息
					worker.postMessage(num.value)
					console.log("主线程向分线程发送数据: " + num.value)
				}
			}
		</script>
	</head>
	<body>
		<input type="text" id="num" name="fibonacci"  />
		<input type="button" id="btn" value="jisuan" name="jisuan"  />
	</body>
</html>
